//
//  OrderModel.m
//  B2C
//
//  Created by 李小龙 on 2017/8/1.
//  Copyright © 2017年 lixiaolong. All rights reserved.
//

#import "OrderModel.h"

@implementation OtopsModel

MJCodingImplementation

@end

@implementation OrdersonModel

MJCodingImplementation
+ (NSDictionary *)mj_objectClassInArray {
    return @{//@"img":[ImgsModel class],
             @"otop":[OtopsModel class]
             };
}
- (NSString *)gprice {
    return [_gprice replacePriceSuffix];
}
@end

@implementation RefundModel

MJCodingImplementation
- (NSString *)rprice {
    return [_rprice replacePriceSuffix];
}
@end

@implementation LogisticsCompanyModel

MJCodingImplementation

@end

@implementation OrderMainModel

MJCodingImplementation

@end

@implementation ShopModel

MJCodingImplementation

@end

@implementation OrderModel

MJCodingImplementation
+ (NSDictionary *)mj_objectClassInArray {
    return @{@"ordergoods":[OrdersonModel class],
             @"refund":[RefundModel class],
             @"otop":[OtopsModel class]};
}
- (NSString *)omprice {
    return [_omprice replacePriceSuffix];
}
- (NSString *)gprice {
    return [_gprice replacePriceSuffix];
}
/*
- (NSString *)omprice {
    double totalPrice = 0;
    for (OrdersonModel *goods in _ordergoods) {
        totalPrice += goods.goldprice.doubleValue;
    }
    _omprice = [NSString stringWithFormat:@"%.2f",totalPrice];
    return _omprice;
}
- (NSString *)omnumber {
    NSInteger totalCount = 0;
    for (OrdersonModel *goods in _ordergoods) {
        if ([goods.gpricetype isEqualToString:@"0"]) {
            totalCount += 1;
        } else {
            totalCount += goods.gshare.integerValue;
        }
    }
    _omnumber = [NSString stringWithFormat:@"%ld",(long)totalCount];
    return _omnumber;
}
 */
@end
